# Set common variables
DEVICES=2 # Assuming you want to use GPU 0 and 1
INDEX="baseline"

# Function to run processes
run_process() {
    local data_path=$1
    local dataset=$2
    local scene=$3
    local index=$4
    local devices=$5

    CUDA_VISIBLE_DEVICES=$devices python train.py -s "${data_path}/${dataset}/${scene}" --eval -m "output/${dataset}/${scene}/${index}" || exit 1
    CUDA_VISIBLE_DEVICES=$devices python render.py -s "${data_path}/${dataset}/${scene}" --eval -m "output/${dataset}/${scene}/${index}" || exit 1
    CUDA_VISIBLE_DEVICES=$devices python metrics.py -m "output/${dataset}/${scene}/${index}" || exit 1
}

# Tanks and Temples Dataset
DATA_PATH="/data1/baihy/datasets"
DATASET="TanksAndTemples"
run_process "$DATA_PATH" "$DATASET" "train" "$INDEX" "$DEVICES"
run_process "$DATA_PATH" "$DATASET" "truck" "$INDEX" "$DEVICES"

# mipnerf360 Dataset
DATASET="mipnerf360"
run_process "$DATA_PATH" "$DATASET" "bicycle" "$INDEX" "$DEVICES"
run_process "$DATA_PATH" "$DATASET" "garden" "$INDEX" "$DEVICES"
run_process "$DATA_PATH" "$DATASET" "stump" "$INDEX" "$DEVICES"
run_process "$DATA_PATH" "$DATASET" "room" "$INDEX" "$DEVICES"
run_process "$DATA_PATH" "$DATASET" "counter" "$INDEX" "$DEVICES"
run_process "$DATA_PATH" "$DATASET" "kitchen" "$INDEX" "$DEVICES"
run_process "$DATA_PATH" "$DATASET" "bonsai" "$INDEX" "$DEVICES"

#deep_blending Dataset
DATASET="deep_blending"
run_process "$DATA_PATH" "$DATASET" "drjohnson" "$INDEX" "$DEVICES"
run_process "$DATA_PATH" "$DATASET" "playroom" "$INDEX" "$DEVICES"